﻿using LoggerNumTest;
using LoggerSystem;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
using NLog.Extensions.Logging;
using Exceptionless;

namespace LoggerDemo
{
    internal class Program
    {
        static void Main(string[] args)
        {
            //ExceptionlessClient.Default.Startup("ILe0GWyj7IStFN9kT66qO5OKWC7T6fQb0NwJKl3j");
           ServiceCollection serivces = new ServiceCollection();
            serivces.AddLogging(logbuilder =>{
                // 系统自带的logging
                logbuilder.AddConsole();
                logbuilder.AddEventLog();
                logbuilder.SetMinimumLevel(LogLevel.Trace);

                // nLog
                logbuilder.ClearProviders();
                logbuilder.AddNLog();


                //logbuilder.AddExceptionless();
            });

            serivces.AddScoped<LogPrint>();
            serivces.AddScoped<NLoggerPrint>();
            serivces.AddScoped<NumPrint>();
            using (var sp = serivces.BuildServiceProvider())
            {
                var logPrint = sp.GetRequiredService<LogPrint>();
                logPrint.PrintInfo("this is test");

                var nlogPrint = sp.GetRequiredService<NLoggerPrint>();
                nlogPrint.PrintLogger();

                var numLogPrint = sp.GetRequiredService<NumPrint>();
                numLogPrint.Print();

            }

            Console.ReadKey();  
        }
    }
}